package com.tywj.buscustomerapp.view.activity.tour;

import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.tywj.buscustomerapp.R;
import com.tywj.buscustomerapp.utils.myadapter.CommonRcvAdapter;
import com.tywj.buscustomerapp.utils.myadapter.item.AdapterItem;
import com.tywj.buscustomerapp.view.activity.BaseActivity;
import com.tywj.buscustomerapp.view.item.ScenicItem;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class HotScenicActivity extends BaseActivity {
    @BindView(R.id.recycler)
    RecyclerView recyclerView;
    @BindView(R.id.head_title)
    TextView title;
    @BindView(R.id.head_left)
    ImageView back;

    private CommonRcvAdapter<String> adapter;
    private List<String> datas = new ArrayList<>();

    @Override
    protected int getContentId() {
        return R.layout.activity_hot_scenic;
    }

    @Override
    protected void initWidget(Bundle savedInstanceState) {
        super.initWidget(savedInstanceState);
        title.setText("热门景区排行榜");
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        adapter = new CommonRcvAdapter<String>(datas) {
            @NonNull
            @Override
            public AdapterItem createItem(Object type) {
                return new ScenicItem();
            }
        };
        recyclerView.setAdapter(adapter);
    }


    @Override
    protected void initData() {
        super.initData();
        for (int i = 0; i < 10; i++) {
            datas.add("title"+i);
        }
        adapter.setData(datas);
        adapter.notifyDataSetChanged();

    }

    @Override
    protected void initClick() {
        super.initClick();
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
